//
//  SetDepartmentViewController.m
//  Login
//
//  Created by ZF on 17/3/25.
//  Copyright © 2017年 ZF. All rights reserved.
//

#import "SetDepartmentViewController.h"
#import "NetworkLink.h"

@interface SetDepartmentViewController () <UIPickerViewDataSource,UIPickerViewDelegate>
{
    AppDelegate *delegate;
    NSArray *dataArr;
}
@end

@implementation SetDepartmentViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    delegate = [Helps app];
    dataArr = [NSArray arrayWithArray:self.dataDict.allKeys];
    
    UIPickerView *picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 350)];
    picker.delegate = self;
    picker.dataSource = self;
    
    UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 50, ScreenWidth, 44)];
    textField.borderStyle = UITextBorderStyleLine;
    textField.inputView = picker;
    [self.view addSubview:textField];
}

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    return dataArr.count;
}

- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    NSString *str = dataArr[row];
    NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:str];
    [attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, str.length)];
    return attributedStr;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
